__author__ = 'maksimfominov'

import BaseHTTPServer
import properties

HOST_NAME = 'localhost'
PORT_NUMBER=int(properties.options['http_port'])

postVars = ''

class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):

    def do_POST(s):
        global postVars
        s.send_response(200)
        s.end_headers()
        varLen = int(s.headers['Content-Length'])
        postVars = s.rfile.read(varLen)
        print postVars

server_class = BaseHTTPServer.HTTPServer
httpd = server_class((HOST_NAME, PORT_NUMBER), MyHandler)
httpd.serve_forever()

try:
    httpd.handle_request()
except KeyboardInterrupt:
    pass

#print postVars
httpd.server_close()